package com.ruoyi.admin.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.admin.domain.NameDataPanel;
import com.ruoyi.admin.domain.DailyData;
import com.ruoyi.admin.service.INameDataPanelService;
import java.util.List;

@RestController
@RequestMapping("/admin/admin")
public class NameDataPanelController {

    @Autowired
    private INameDataPanelService nameDataPanelService;

    @GetMapping("/statistics")
    public NameDataPanel getStatistics() {
        // 修复：使用正确的注入服务对象变量名
        return nameDataPanelService.getDashboardStats();
    }

    /**
     * 获取近30天的订单和收益数据
     * @return 近30天的每日数据列表
     */
    @GetMapping("/lastThirtyDaysData")
    public List<DailyData> getLastThirtyDaysData() {
        return nameDataPanelService.getLastThirtyDaysData();
    }
}